<template>
  <view v-if="copyright" class="">
    <!-- 拨打电话 -->
    <view
      @click="makingPhoneCalls"
      v-if="copyright.type == 1"
      class="flex-col flex-y-center"
    >
      <image
        :src="copyright.logo"
        mode="aspectFill"
        style="width: 60rpx; height: 60rpx"
      ></image>
      <div class="color-999">{{ copyright.copyright }}</div>
    </view>
    <ToUrlView v-else :urlObj="copyright.mini_url">
      <view class="flex-col flex-y-center">
        <image
          :src="copyright.logo"
          mode="aspectFill"
          style="width: 60rpx; height: 60rpx"
        ></image>
        <div class="color-999">
          {{ copyright.copyright }}
        </div>
      </view>
    </ToUrlView>
  </view>
</template>

<script>
import ToUrlView from "@/components/ToUrlView";
import { getStoreSwitch } from "@/api/system";

export default {
  components: {
    ToUrlView
  },
  data() {
    return {
      copyright: ""
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    async init() {
      const res = await getStoreSwitch();
      if (!res.code) {
        this.$store.commit("setStoreId", res.data.store_id);
        this.copyright = res.data.copyright;
      }
    },
    makingPhoneCalls() {
      this.$utils.makePhoneCall(this.copyright.mobile);
    }
  }
};
</script>

<style></style>
